﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Potential_Software.Win32
{
    public class WinUser
    {
        //Boolean
        public static IntPtr TRUE { get { return (IntPtr)1; } }
        public static IntPtr FALSE { get { return (IntPtr)0; } }

        //Macros
        public static string MAKEINTRESOURCE(int i)
        {
            return ((UIntPtr)((ushort)(i))).ToString();
        }
        public static ushort LOWORD(int i)
        {
            return ((ushort)((i) & 0xFFFF));
        }
        public static ushort HIWORD(int i)
        {
            return ((ushort)((i >> 16) & 0xFFFF));
        }

        //Windows Messages
        public static readonly uint WM_NULL = 0x00;
        public static readonly uint WM_CREATE = 0x01;
        public static readonly uint WM_DESTROY = 0x02;
        public static readonly uint WM_MOVE = 0x03;
        public static readonly uint WM_SIZE = 0x05;
        public static readonly uint WM_ACTIVATE = 0x06;
        public static readonly uint WM_SETFOCUS = 0x07;
        public static readonly uint WM_KILLFOCUS = 0x08;
        public static readonly uint WM_ENABLE = 0x0A;
        public static readonly uint WM_SETREDRAW = 0x0B;
        public static readonly uint WM_SETTEXT = 0x0C;
        public static readonly uint WM_GETTEXT = 0x0D;
        public static readonly uint WM_GETTEXTLENGTH = 0x0E;
        public static readonly uint WM_PAINT = 0x0F;
        public static readonly uint WM_CLOSE = 0x10;
        public static readonly uint WM_QUERYENDSESSION = 0x11;
        public static readonly uint WM_QUIT = 0x12;
        public static readonly uint WM_QUERYOPEN = 0x13;
        public static readonly uint WM_ERASEBKGND = 0x14;
        public static readonly uint WM_SYSCOLORCHANGE = 0x15;
        public static readonly uint WM_ENDSESSION = 0x16;
        public static readonly uint WM_SYSTEMERROR = 0x17;
        public static readonly uint WM_SHOWWINDOW = 0x18;
        public static readonly uint WM_CTLCOLOR = 0x19;
        public static readonly uint WM_WININICHANGE = 0x1A;
        public static readonly uint WM_SETTINGCHANGE = 0x1A;
        public static readonly uint WM_DEVMODECHANGE = 0x1B;
        public static readonly uint WM_ACTIVATEAPP = 0x1C;
        public static readonly uint WM_FONTCHANGE = 0x1D;
        public static readonly uint WM_TIMECHANGE = 0x1E;
        public static readonly uint WM_CANCELMODE = 0x1F;
        public static readonly uint WM_SETCURSOR = 0x20;
        public static readonly uint WM_MOUSEACTIVATE = 0x21;
        public static readonly uint WM_CHILDACTIVATE = 0x22;
        public static readonly uint WM_QUEUESYNC = 0x23;
        public static readonly uint WM_GETMINMAXINFO = 0x24;
        public static readonly uint WM_PAINTICON = 0x26;
        public static readonly uint WM_ICONERASEBKGND = 0x27;
        public static readonly uint WM_NEXTDLGCTL = 0x28;
        public static readonly uint WM_SPOOLERSTATUS = 0x2A;
        public static readonly uint WM_DRAWITEM = 0x2B;
        public static readonly uint WM_MEASUREITEM = 0x2C;
        public static readonly uint WM_DELETEITEM = 0x2D;
        public static readonly uint WM_VKEYTOITEM = 0x2E;
        public static readonly uint WM_CHARTOITEM = 0x2F;
        public static readonly uint WM_SETFONT = 0x30;
        public static readonly uint WM_GETFONT = 0x31;
        public static readonly uint WM_SETHOTKEY = 0x32;
        public static readonly uint WM_GETHOTKEY = 0x33;
        public static readonly uint WM_QUERYDRAGICON = 0x37;
        public static readonly uint WM_COMPAREITEM = 0x39;
        public static readonly uint WM_COMPACTING = 0x41;
        public static readonly uint WM_WINDOWPOSCHANGING = 0x46;
        public static readonly uint WM_WINDOWPOSCHANGED = 0x47;
        public static readonly uint WM_POWER = 0x48;
        public static readonly uint WM_COPYDATA = 0x4A;
        public static readonly uint WM_CANCELJOURNAL = 0x4B;
        public static readonly uint WM_NOTIFY = 0x4E;
        public static readonly uint WM_INPUTLANGCHANGEREQUEST = 0x50;
        public static readonly uint WM_INPUTLANGCHANGE = 0x51;
        public static readonly uint WM_TCARD = 0x52;
        public static readonly uint WM_HELP = 0x53;
        public static readonly uint WM_USERCHANGED = 0x54;
        public static readonly uint WM_NOTIFYFORMAT = 0x55;
        public static readonly uint WM_CONTEXTMENU = 0x7B;
        public static readonly uint WM_STYLECHANGING = 0x7C;
        public static readonly uint WM_STYLECHANGED = 0x7D;
        public static readonly uint WM_DISPLAYCHANGE = 0x7E;
        public static readonly uint WM_GETICON = 0x7F;
        public static readonly uint WM_SETICON = 0x80;
        public static readonly uint WM_NCCREATE = 0x81;
        public static readonly uint WM_NCDESTROY = 0x82;
        public static readonly uint WM_NCCALCSIZE = 0x83;
        public static readonly uint WM_NCHITTEST = 0x84;
        public static readonly uint WM_NCPAINT = 0x85;
        public static readonly uint WM_NCACTIVATE = 0x86;
        public static readonly uint WM_GETDLGCODE = 0x87;
        public static readonly uint WM_NCMOUSEMOVE = 0xA0;
        public static readonly uint WM_NCLBUTTONDOWN = 0xA1;
        public static readonly uint WM_NCLBUTTONUP = 0xA2;
        public static readonly uint WM_NCLBUTTONDBLCLK = 0xA3;
        public static readonly uint WM_NCRBUTTONDOWN = 0xA4;
        public static readonly uint WM_NCRBUTTONUP = 0xA5;
        public static readonly uint WM_NCRBUTTONDBLCLK = 0xA6;
        public static readonly uint WM_NCMBUTTONDOWN = 0xA7;
        public static readonly uint WM_NCMBUTTONUP = 0xA8;
        public static readonly uint WM_NCMBUTTONDBLCLK = 0xA9;
        public static readonly uint WM_KEYFIRST = 0x100;
        public static readonly uint WM_KEYDOWN = 0x100;
        public static readonly uint WM_KEYUP = 0x101;
        public static readonly uint WM_CHAR = 0x102;
        public static readonly uint WM_DEADCHAR = 0x103;
        public static readonly uint WM_SYSKEYDOWN = 0x104;
        public static readonly uint WM_SYSKEYUP = 0x105;
        public static readonly uint WM_SYSCHAR = 0x106;
        public static readonly uint WM_SYSDEADCHAR = 0x107;
        public static readonly uint WM_KEYLAST = 0x108;
        public static readonly uint WM_IME_STARTCOMPOSITION = 0x10D;
        public static readonly uint WM_IME_ENDCOMPOSITION = 0x10E;
        public static readonly uint WM_IME_COMPOSITION = 0x10F;
        public static readonly uint WM_IME_KEYLAST = 0x10F;
        public static readonly uint WM_INITDIALOG = 0x110;
        public static readonly uint WM_COMMAND = 0x111;
        public static readonly uint WM_SYSCOMMAND = 0x112;
        public static readonly uint WM_TIMER = 0x113;
        public static readonly uint WM_HSCROLL = 0x114;
        public static readonly uint WM_VSCROLL = 0x115;
        public static readonly uint WM_INITMENU = 0x116;
        public static readonly uint WM_INITMENUPOPUP = 0x117;
        public static readonly uint WM_MENUSELECT = 0x11F;
        public static readonly uint WM_MENUCHAR = 0x120;
        public static readonly uint WM_ENTERIDLE = 0x121;
        public static readonly uint WM_CTLCOLORMSGBOX = 0x132;
        public static readonly uint WM_CTLCOLOREDIT = 0x133;
        public static readonly uint WM_CTLCOLORLISTBOX = 0x134;
        public static readonly uint WM_CTLCOLORBTN = 0x135;
        public static readonly uint WM_CTLCOLORDLG = 0x136;
        public static readonly uint WM_CTLCOLORSCROLLBAR = 0x137;
        public static readonly uint WM_CTLCOLORSTATIC = 0x138;
        public static readonly uint WM_MOUSEFIRST = 0x200;
        public static readonly uint WM_MOUSEMOVE = 0x200;
        public static readonly uint WM_LBUTTONDOWN = 0x201;
        public static readonly uint WM_LBUTTONUP = 0x202;
        public static readonly uint WM_LBUTTONDBLCLK = 0x203;
        public static readonly uint WM_RBUTTONDOWN = 0x204;
        public static readonly uint WM_RBUTTONUP = 0x205;
        public static readonly uint WM_RBUTTONDBLCLK = 0x206;
        public static readonly uint WM_MBUTTONDOWN = 0x207;
        public static readonly uint WM_MBUTTONUP = 0x208;
        public static readonly uint WM_MBUTTONDBLCLK = 0x209;
        public static readonly uint WM_MOUSEWHEEL = 0x20A;
        public static readonly uint WM_MOUSEHWHEEL = 0x20E;
        public static readonly uint WM_PARENTNOTIFY = 0x210;
        public static readonly uint WM_ENTERMENULOOP = 0x211;
        public static readonly uint WM_EXITMENULOOP = 0x212;
        public static readonly uint WM_NEXTMENU = 0x213;
        public static readonly uint WM_SIZING = 0x214;
        public static readonly uint WM_CAPTURECHANGED = 0x215;
        public static readonly uint WM_MOVING = 0x216;
        public static readonly uint WM_POWERBROADCAST = 0x218;
        public static readonly uint WM_DEVICECHANGE = 0x219;
        public static readonly uint WM_MDICREATE = 0x220;
        public static readonly uint WM_MDIDESTROY = 0x221;
        public static readonly uint WM_MDIACTIVATE = 0x222;
        public static readonly uint WM_MDIRESTORE = 0x223;
        public static readonly uint WM_MDINEXT = 0x224;
        public static readonly uint WM_MDIMAXIMIZE = 0x225;
        public static readonly uint WM_MDITILE = 0x226;
        public static readonly uint WM_MDICASCADE = 0x227;
        public static readonly uint WM_MDIICONARRANGE = 0x228;
        public static readonly uint WM_MDIGETACTIVE = 0x229;
        public static readonly uint WM_MDISETMENU = 0x230;
        public static readonly uint WM_ENTERSIZEMOVE = 0x231;
        public static readonly uint WM_EXITSIZEMOVE = 0x232;
        public static readonly uint WM_DROPFILES = 0x233;
        public static readonly uint WM_MDIREFRESHMENU = 0x234;
        public static readonly uint WM_IME_SETCONTEXT = 0x281;
        public static readonly uint WM_IME_NOTIFY = 0x282;
        public static readonly uint WM_IME_CONTROL = 0x283;
        public static readonly uint WM_IME_COMPOSITIONFULL = 0x284;
        public static readonly uint WM_IME_SELECT = 0x285;
        public static readonly uint WM_IME_CHAR = 0x286;
        public static readonly uint WM_IME_KEYDOWN = 0x290;
        public static readonly uint WM_IME_KEYUP = 0x291;
        public static readonly uint WM_MOUSEHOVER = 0x2A1;
        public static readonly uint WM_NCMOUSELEAVE = 0x2A2;
        public static readonly uint WM_MOUSELEAVE = 0x2A3;
        public static readonly uint WM_CUT = 0x300;
        public static readonly uint WM_COPY = 0x301;
        public static readonly uint WM_PASTE = 0x302;
        public static readonly uint WM_CLEAR = 0x303;
        public static readonly uint WM_UNDO = 0x304;
        public static readonly uint WM_RENDERFORMAT = 0x305;
        public static readonly uint WM_RENDERALLFORMATS = 0x306;
        public static readonly uint WM_DESTROYCLIPBOARD = 0x307;
        public static readonly uint WM_DRAWCLIPBOARD = 0x308;
        public static readonly uint WM_PAINTCLIPBOARD = 0x309;
        public static readonly uint WM_VSCROLLCLIPBOARD = 0x30A;
        public static readonly uint WM_SIZECLIPBOARD = 0x30B;
        public static readonly uint WM_ASKCBFORMATNAME = 0x30C;
        public static readonly uint WM_CHANGECBCHAIN = 0x30D;
        public static readonly uint WM_HSCROLLCLIPBOARD = 0x30E;
        public static readonly uint WM_QUERYNEWPALETTE = 0x30F;
        public static readonly uint WM_PALETTEISCHANGING = 0x310;
        public static readonly uint WM_PALETTECHANGED = 0x311;
        public static readonly uint WM_HOTKEY = 0x312;
        public static readonly uint WM_PRINT = 0x317;
        public static readonly uint WM_PRINTCLIENT = 0x318;
        public static readonly uint WM_HANDHELDFIRST = 0x358;
        public static readonly uint WM_HANDHELDLAST = 0x35F;
        public static readonly uint WM_PENWINFIRST = 0x380;
        public static readonly uint WM_PENWINLAST = 0x38F;
        public static readonly uint WM_COALESCE_FIRST = 0x390;
        public static readonly uint WM_COALESCE_LAST = 0x39F;
        public static readonly uint WM_DDE_FIRST = 0x3E0;
        public static readonly uint WM_DDE_INITIATE = 0x3E0;
        public static readonly uint WM_DDE_TERMINATE = 0x3E1;
        public static readonly uint WM_DDE_ADVISE = 0x3E2;
        public static readonly uint WM_DDE_UNADVISE = 0x3E3;
        public static readonly uint WM_DDE_ACK = 0x3E4;
        public static readonly uint WM_DDE_DATA = 0x3E5;
        public static readonly uint WM_DDE_REQUEST = 0x3E6;
        public static readonly uint WM_DDE_POKE = 0x3E7;
        public static readonly uint WM_DDE_EXECUTE = 0x3E8;
        public static readonly uint WM_DDE_LAST = 0x3E8;
        public static readonly uint WM_USER = 0x400;
        public static readonly uint WM_APP = 0x8000;

        //GetDCEx() Flags
        public static readonly int DCX_WINDOW = 0x00000001;
        public static readonly int DCX_CACHE = 0x00000002;
        public static readonly int DCX_PARENTCLIP = 0x00000020;
        public static readonly int DCX_CLIPSIBLINGS = 0x00000010;
        public static readonly int DCX_CLIPCHILDREN = 0x00000008;
        public static readonly int DCX_NORESETATTRS = 0x00000004;
        public static readonly int DCX_LOCKWINDOWUPDATE = 0x00000400;
        public static readonly int DCX_EXCLUDERGN = 0x00000040;
        public static readonly int DCX_INTERSECTRGN = 0x00000080;
        public static readonly int DCX_INTERSECTUPDATE = 0x00000200;
        public static readonly int DCX_VALIDATE = 0x00200000;

        //ShowWindow() Flags
        public static readonly int SW_FORCEMINIMIZE = 11;
        public static readonly int SW_HIDE = 0;
        public static readonly int SW_MAXIMIZE = 3;
        public static readonly int SW_MINIMIZE = 6;
        public static readonly int SW_RESTORE = 9;
        public static readonly int SW_SHOW = 5;
        public static readonly int SW_SHOWDEFAULT = 10;
        public static readonly int SW_SHOWMAXIMIZED = 3;
        public static readonly int SW_SHOWMINIMIZED = 2;
        public static readonly int SW_SHOWMINNOACTIVE = 7;
        public static readonly int SW_SHOWNA = 8;
        public static readonly int SW_SHOWNOACTIVATE = 4;
        public static readonly int SW_SHOWNORMAL = 1;

        //SetWindowPos() Flags
        public static readonly uint SWP_ASYNCWINDOWPOS = 0x4000;
        public static readonly uint SWP_DEFERERASE = 0x2000;
        public static readonly uint SWP_DRAWFRAME = 0x0020;
        public static readonly uint SWP_FRAMECHANGED = 0x0020;
        public static readonly uint SWP_HIDEWINDOW = 0x0080;
        public static readonly uint SWP_NOACTIVATE = 0x0010;
        public static readonly uint SWP_NOCOPYBITS = 0x0100;
        public static readonly uint SWP_NOMOVE = 0x0002;
        public static readonly uint SWP_NOOWNERZORDER = 0x0200;
        public static readonly uint SWP_NOREDRAW = 0x0008;
        public static readonly uint SWP_NOREPOSITION = 0x0200;
        public static readonly uint SWP_NOSENDCHANGING = 0x0400;
        public static readonly uint SWP_NOSIZE = 0x0001;
        public static readonly uint SWP_NOZORDER = 0x0004;
        public static readonly uint SWP_SHOWWINDOW = 0x0040;

        //RedrawWindow() Flags
        public static readonly uint RDW_ERASE = 0x0004;
        public static readonly uint RDW_FRAME = 0x0400;
        public static readonly uint RDW_INTERNALPAINT = 0x0002;
        public static readonly uint RDW_INVALIDATE = 0x0001;
        public static readonly uint RDW_NOERASE = 0x0020;
        public static readonly uint RDW_NOFRAME = 0x0800;
        public static readonly uint RDW_NOINTERNALPAINT = 0x0010;
        public static readonly uint RDW_VALIDATE = 0x0008;
        public static readonly uint RDW_ERASENOW = 0x0200;
        public static readonly uint RDW_UPDATENOW = 0x0100;
        public static readonly uint RDW_ALLCHILDREN = 0x0080;
        public static readonly uint RDW_NOCHILDREN = 0x0040;

        //HitTest Values
        public static readonly int HTERROR = -2;
        public static readonly int HTTRANSPARENT = -1;
        public static readonly int HTNOWHERE = 0;
        public static readonly int HTCLIENT = 1;
        public static readonly int HTCAPTION = 2;
        public static readonly int HTSYSMENU = 3;
        public static readonly int HTGROWBOX = 4;
        public static readonly int HTSIZE = 4;
        public static readonly int HTMENU = 5;
        public static readonly int HTHSCROLL = 6;
        public static readonly int HTVSCROLL = 7;
        public static readonly int HTMINBUTTON = 8;
        public static readonly int HTREDUCE = 8;
        public static readonly int HTMAXBUTTON = 9;
        public static readonly int HTZOOM = 9;
        public static readonly int HTLEFT = 10;
        public static readonly int HTRIGHT = 11;
        public static readonly int HTTOP = 12;
        public static readonly int HTTOPLEFT = 13;
        public static readonly int HTTOPRIGHT = 14;
        public static readonly int HTBOTTOM = 15;
        public static readonly int HTBOTTOMLEFT = 16;
        public static readonly int HTBOTTOMRIGHT = 17;
        public static readonly int HTBORDER = 18;
        public static readonly int HTCLOSE = 20;
        public static readonly int HTHELP = 21;

        //Class Styles

        public static readonly int CS_BYTEALIGNCLIENT = 0x1000;
        public static readonly int CS_BYTEALIGNWINDOW = 0x2000;
        public static readonly int CS_CLASSDC = 0x0040;
        public static readonly int CS_DBLCLKS = 0x0008;
        public static readonly int CS_DROPSHADOW = 0x00020000;
        public static readonly int CS_GLOBALCLASS = 0x4000;
        public static readonly int CS_HREDRAW = 0x0002;
        public static readonly int CS_NOCLOSE = 0x0200;
        public static readonly int CS_OWNDC = 0x0020;
        public static readonly int CS_PARENTDC = 0x0080;
        public static readonly int CS_SAVEBITS = 0x0800;
        public static readonly int CS_VREDRAW = 0x0001;

        //Standard Cursor ID's
        public static readonly string IDC_ARROW = MAKEINTRESOURCE(32512);
        public static readonly string IDC_IBEAM = MAKEINTRESOURCE(32513);
        public static readonly string IDC_WAIT = MAKEINTRESOURCE(32514);
        public static readonly string IDC_CROSS = MAKEINTRESOURCE(32515);
        public static readonly string IDC_UPARROW = MAKEINTRESOURCE(32516);
        public static readonly string IDC_SIZE = MAKEINTRESOURCE(32640);
        public static readonly string IDC_ICON = MAKEINTRESOURCE(32641);
        public static readonly string IDC_SIZENWSE = MAKEINTRESOURCE(32642);
        public static readonly string IDC_SIZENESW = MAKEINTRESOURCE(32643);
        public static readonly string IDC_SIZEWE = MAKEINTRESOURCE(32644);
        public static readonly string IDC_SIZENS = MAKEINTRESOURCE(32645);
        public static readonly string IDC_SIZEALL = MAKEINTRESOURCE(32646);
        public static readonly string IDC_NO = MAKEINTRESOURCE(32648);
        public static readonly string IDC_HAND = MAKEINTRESOURCE(32649);
        public static readonly string IDC_APPSTARTING = MAKEINTRESOURCE(32650);
        public static readonly string IDC_HELP = MAKEINTRESOURCE(32651);

        //Color Types
        public static readonly int CTLCOLOR_MSGBOX = 0;
        public static readonly int CTLCOLOR_EDIT = 1;
        public static readonly int CTLCOLOR_LISTBOX = 2;
        public static readonly int CTLCOLOR_BTN = 3;
        public static readonly int CTLCOLOR_DLG = 4;
        public static readonly int CTLCOLOR_SCROLLBAR = 5;
        public static readonly int CTLCOLOR_STATIC = 6;
        public static readonly int CTLCOLOR_MAX = 7;
        public static readonly int COLOR_SCROLLBAR = 0;
        public static readonly int COLOR_BACKGROUND = 1;
        public static readonly int COLOR_ACTIVECAPTION = 2;
        public static readonly int COLOR_INACTIVECAPTION = 3;
        public static readonly int COLOR_MENU = 4;
        public static readonly int COLOR_WINDOW = 5;
        public static readonly int COLOR_WINDOWFRAME = 6;
        public static readonly int COLOR_MENUTEXT = 7;
        public static readonly int COLOR_WINDOWTEXT = 8;
        public static readonly int COLOR_CAPTIONTEXT = 9;
        public static readonly int COLOR_ACTIVEBORDER = 10;
        public static readonly int COLOR_INACTIVEBORDER = 11;
        public static readonly int COLOR_APPWORKSPACE = 12;
        public static readonly int COLOR_HIGHLIGHT = 13;
        public static readonly int COLOR_HIGHLIGHTTEXT = 14;
        public static readonly int COLOR_BTNFACE = 15;
        public static readonly int COLOR_BTNSHADOW = 16;
        public static readonly int COLOR_GRAYTEXT = 17;
        public static readonly int COLOR_BTNTEXT = 18;
        public static readonly int COLOR_INACTIVECAPTIONTEXT = 19;
        public static readonly int COLOR_BTNHIGHLIGHT = 20;

        //MonitorFromWindow Flags
        public static readonly uint MONITOR_DEFAULTTONEAREST = 0x00000002;
        public static readonly uint MONITOR_DEFAULTTONULL = 0x00000000;
        public static readonly uint MONITOR_DEFAULTTOPRIMARY = 0x00000004;

        //Window Styles
        public static readonly long WS_OVERLAPPED = 0x00000000L;
        public static readonly long WS_POPUP = 0x80000000L;
        public static readonly long WS_CHILD = 0x40000000L;
        public static readonly long WS_MINIMIZE = 0x20000000L;
        public static readonly long WS_VISIBLE = 0x10000000L;
        public static readonly long WS_DISABLED = 0x08000000L;
        public static readonly long WS_CLIPSIBLINGS = 0x04000000L;
        public static readonly long WS_CLIPCHILDREN = 0x02000000L;
        public static readonly long WS_MAXIMIZE = 0x01000000L;
        public static readonly long WS_CAPTION = 0x00C00000L;
        public static readonly long WS_BORDER = 0x00800000L;
        public static readonly long WS_DLGFRAME = 0x00400000L;
        public static readonly long WS_VSCROLL = 0x00200000L;
        public static readonly long WS_HSCROLL = 0x00100000L;
        public static readonly long WS_SYSMENU = 0x00080000L;
        public static readonly long WS_THICKFRAME = 0x00040000L;
        public static readonly long WS_GROUP = 0x00020000L;
        public static readonly long WS_TABSTOP = 0x00010000L;
        public static readonly long WS_MINIMIZEBOX = 0x00020000L;
        public static readonly long WS_MAXIMIZEBOX = 0x00010000L;
        public static readonly long WS_TILED = WS_OVERLAPPED;
        public static readonly long WS_ICONIC = WS_MINIMIZE;
        public static readonly long WS_SIZEBOX = WS_THICKFRAME;
        public static readonly long WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
        public static readonly long WS_CHILDWINDOW = WS_CHILD;
        public static readonly long WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
        public static readonly long WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU);

        //Window field offsets for GetWidnowLong()
        public static readonly int GWL_WNDPROC = (-4);
        public static readonly int GWL_HINSTANCE = (-6);
        public static readonly int GWL_HWNDPARENT = (-8);
        public static readonly int GWL_STYLE = (-16);
        public static readonly int GWL_EXSTYLE = (-20);
        public static readonly int GWL_USERDATA = (-21);
        public static readonly int GWL_ID = (-12);

        //BitBlt Flags
        public static readonly uint SRCCOPY = 0x00CC0020;
        public static readonly uint SRCPAINT = 0x00EE0086;
        public static readonly uint SRCAND = 0x008800C6;
        public static readonly uint SRCINVERT = 0x00660046;
        public static readonly uint SRCERASE = 0x00440328;
        public static readonly uint NOTSRCCOPY = 0x00330008;
        public static readonly uint NOTSRCERASE = 0x001100A6;
        public static readonly uint MERGECOPY = 0x00C000CA;
        public static readonly uint MERGEPAINT = 0x00BB0226;
        public static readonly uint PATCOPY = 0x00F00021;
        public static readonly uint PATPAINT = 0x00FB0A09;
        public static readonly uint PATINVERT = 0x005A0049;
        public static readonly uint DSTINVERT = 0x00550009;
        public static readonly uint BLACKNESS = 0x00000042;
        public static readonly uint WHITENESS = 0x00FF0062;
        public static readonly uint CAPTUREBLT = 0x40000000;

        //Extended Window Styles
        public static readonly long WS_EX_DLGMODALFRAME = 0x00000001L;
        public static readonly long WS_EX_NOPARENTNOTIFY = 0x00000004L;
        public static readonly long WS_EX_TOPMOST = 0x00000008L;
        public static readonly long WS_EX_ACCEPTFILES = 0x00000010L;
        public static readonly long WS_EX_TRANSPARENT = 0x00000020L;
        public static readonly long WS_EX_MDICHILD = 0x00000040L;
        public static readonly long WS_EX_TOOLWINDOW = 0x00000080L;
        public static readonly long WS_EX_WINDOWEDGE = 0x00000100L;
        public static readonly long WS_EX_CLIENTEDGE = 0x00000200L;
        public static readonly long WS_EX_CONTEXTHELP = 0x00000400L;
        public static readonly long WS_EX_RIGHT = 0x00001000L;
        public static readonly long WS_EX_LEFT = 0x00000000L;
        public static readonly long WS_EX_RTLREADING = 0x00002000L;
        public static readonly long WS_EX_LTRREADING = 0x00000000L;
        public static readonly long WS_EX_LEFTSCROLLBAR = 0x00004000L;
        public static readonly long WS_EX_RIGHTSCROLLBAR = 0x00000000L;
        public static readonly long WS_EX_CONTROLPARENT = 0x00010000L;
        public static readonly long WS_EX_STATICEDGE = 0x00020000L;
        public static readonly long WS_EX_APPWINDOW = 0x00040000L;
        public static readonly long WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE);
        public static readonly long WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);
        public static readonly long WS_EX_LAYERED = 0x00080000;
        public static readonly long WS_EX_NOINHERITLAYOUT = 0x00100000L;
        public static readonly long WS_EX_NOREDIRECTIONBITMAP = 0x00200000L;
        public static readonly long WS_EX_LAYOUTRTL = 0x00400000L;
        public static readonly long WS_EX_COMPOSITED = 0x02000000L;
        public static readonly long WS_EX_NOACTIVATE = 0x08000000L;

        public static readonly uint ULW_COLORKEY = 0x00000001;
        public static readonly uint ULW_ALPHA = 0x00000002;
        public static readonly uint ULW_OPAQUE = 0x00000004;

        public static readonly byte AC_SRC_OVER = 0x00;
        public static readonly byte AC_SRC_ALPHA = 0x01;
    }
    public static class Kernel32
    {
        [DllImport("kernel32.dll")]
        public static extern IntPtr GetModuleHandle(
            string lpModuleName
            );
    }
    public static class User32
    {
        [DllImport("user32.dll")]
        public static extern bool DestroyIcon(
            IntPtr hIcon
            );

        [DllImport("user32.dll")]
        public static extern IntPtr DefWindowProc(
            IntPtr hWnd,
            uint Msg,
            IntPtr wParam,
            IntPtr lParam
            );

        [DllImport("user32.dll")]
        public static extern int LoadString(
            IntPtr hInstance,
            uint uID,
            [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
            ref string lpBuffer,
            int cchBufferMax
            );

        [DllImport("user32.dll")]
        public static extern IntPtr GetMessage(
            ref MSG lpMsg,
            IntPtr hWnd,
            uint wMsgFilterMin,
            uint wMsgFilterMax
            );

        [DllImport("user32.dll")]
        public static extern IntPtr LoadAccelerators(
            IntPtr hInstance,
            string lpTableName
            );

        [DllImport("user32.dll")]
        public static extern IntPtr TranslateAccelerator(
            IntPtr hWnd,
            IntPtr hAccTable,
            MSG lpMsg
            );

        [DllImport("user32.dll")]
        public static extern IntPtr TranslateMessage(
            MSG lpMsg
            );

        [DllImport("user32.dll")]
        public static extern IntPtr DispatchMessage(
            MSG lpMsg
            );

        [DllImport("user32.dll")]
        public static extern IntPtr LoadCursor(
            IntPtr hInstance,
            string lpCursorName);

        [DllImport("user32.dll", SetLastError = true)]
        public static extern ushort RegisterClass(
            [In] ref WNDCLASS lpWndClass
        );

        [DllImport("user32.dll")]
        public static extern ushort RegisterClassEx(
            [In] ref WNDCLASSEX wndClassEx
            );

        [DllImport("user32.dll")]
        public static extern IntPtr CreateWindowEx(
            uint dwExStyle,
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
            StringBuilder lpClassName,
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
            StringBuilder lpWindowName,
            uint dwStyle,
            int X,
            int Y,
            int nWidth,
            int nHeight,
            IntPtr hWndParent,
            IntPtr hMenu,
            IntPtr hInstance,
            IntPtr lpParam
            );

        [DllImport("user32.dll", SetLastError = true)]
        public static extern bool DestroyWindow(
            IntPtr hWnd
        );

        [DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr FindWindow(
            [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
            [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName
            );

        [DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr FindWindowEx(
            IntPtr hwndParent,
            IntPtr hwndChildAfter,
            [MarshalAs(UnmanagedType.LPWStr)] string lpszClass,
            [MarshalAs(UnmanagedType.LPWStr)] string lpszWindow
            );

        [DllImport("user32")]
        public static extern IntPtr SetWindowLong(
            IntPtr hWnd,
            int nIndex,
            long dwNewLong
            );

        [DllImport("user32.dll")]
        public static extern IntPtr ShowWindow(
            IntPtr hWnd,
            int nCmdShow
            );

        [DllImport("user32.dll")]
        public static extern IntPtr UpdateWindow(
            IntPtr hWnd
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetWindowRect(
            IntPtr hwnd,
            out  RECT lpRect
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetWindowPos(
            IntPtr hWnd,
            IntPtr hWndInsertAfter,
            int X,
            int Y,
            int cx,
            int cy,
            uint uFlags
            );

        [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
        public static extern IntPtr GetDC(
            IntPtr hWnd
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        public static extern IntPtr GetWindowDC(
            IntPtr hWnd
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        public static extern IntPtr GetDCEx(
            IntPtr hWnd,
            IntPtr hrgnClip,
            int flags
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool ReleaseDC(
            IntPtr hWnd,
            IntPtr hDC
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool RedrawWindow(
            IntPtr hWnd,
            ref RECT lprcUpdate,
            IntPtr hrgnUpdate,
            uint flags
            );

        [DllImport("user32.dll", ExactSpelling = true)]
        public static extern void DisableProcessWindowsGhosting(
            );

        [DllImport("user32.dll")]
        public static extern IntPtr SendMessage(
            IntPtr hWnd,
            uint Msg,
            int wParam,
            int lParam);

        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture(
            );

        [DllImport("user32.dll")]
        public static extern IntPtr SetCapture(
            IntPtr hWnd
            );

        [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool UpdateLayeredWindow(
            IntPtr hwnd,
            IntPtr hdcDst,
            ref POINT pptDst,
            ref SIZE psize,
            IntPtr hdcSrc,
            ref POINT pprSrc,
            Int32 crKey,
            ref BLENDFUNCTION pblend,
            uint dwFlags
            );

        [DllImport("user32.dll")]
        public static extern IntPtr MonitorFromWindow(
            IntPtr hwnd,
            uint dwFlags
            );
    }
    public static class Gdi32
    {
        [DllImport("gdi32.dll", ExactSpelling = true)]
        public static extern IntPtr SelectObject(
            IntPtr hDC,
            IntPtr hObject
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        public extern static IntPtr CreateCompatibleDC(
            IntPtr hDC
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        public static extern IntPtr CreateCompatibleBitmap(
            IntPtr hDC,
            int nWidth,
            int nHeight
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        public static extern bool BitBlt(
            IntPtr hdcDest,
            int nXDest,
            int nYDest,
            int nWidth,
            int nHeight,
            IntPtr hdcSrc,
            int nXSrc,
            int nYSrc,
            uint dwRop
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public extern static bool DeleteDC(
            IntPtr hdc
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public extern static bool DeleteObject(
            IntPtr hObject
            );

        [DllImport("gdi32.dll", ExactSpelling = true)]
        public static extern IntPtr AddFontMemResourceEx(
            byte[] pbFont, 
            uint cbFont, 
            IntPtr pdv, 
            uint pcFonts
            );
    }
    public static class Uxtheme
    {
        [DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
        public static extern int SetWindowTheme(
            IntPtr hWnd,
            String pszSubAppName,
            String pszSubIdList);
    }
    public static class DwmAPI
    {
        [DllImport("dwmapi.dll")]
        public static extern bool DwmDefWindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, out IntPtr result);

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmEnableBlurBehindWindow(
            IntPtr hWnd,
            DWM_BLURBEHIND pBlurBehind
            );

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmEnableComposition(
            uint uCompositionAction
            );

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmEnableMMCSS(
            bool fEnableMMCSS
            );

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmExtendFrameIntoClientArea(
            IntPtr hWnd,
            ref MARGINS pMarInset
            );

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmGetColorizationColor(
            ref uint pcrColorization,
            ref bool pfOpaqueBlend
            );

        [DllImport("Dwmapi.dll")]
        public static extern IntPtr DwmIsCompositionEnabled(
            [Out][MarshalAs(UnmanagedType.Bool)]out bool pfEnabled
            );
    }
    public static class Shell32
    {
        [DllImport("shell32.dll")]
        public static extern uint ExtractIconEx(
                string lpszFile,
                int nIconIndex,
                out IntPtr phiconLarge,
                out IntPtr phiconSmall,
                uint nIcons
            );
    }

    public enum Messages : uint
    {
        WM_NULL = 0x00,
        WM_CREATE = 0x01,
        WM_DESTROY = 0x02,
        WM_MOVE = 0x03,
        WM_SIZE = 0x05,
        WM_ACTIVATE = 0x06,
        WM_SETFOCUS = 0x07,
        WM_KILLFOCUS = 0x08,
        WM_ENABLE = 0x0A,
        WM_SETREDRAW = 0x0B,
        WM_SETTEXT = 0x0C,
        WM_GETTEXT = 0x0D,
        WM_GETTEXTLENGTH = 0x0E,
        WM_PAINT = 0x0F,
        WM_CLOSE = 0x10,
        WM_QUERYENDSESSION = 0x11,
        WM_QUIT = 0x12,
        WM_QUERYOPEN = 0x13,
        WM_ERASEBKGND = 0x14,
        WM_SYSCOLORCHANGE = 0x15,
        WM_ENDSESSION = 0x16,
        WM_SYSTEMERROR = 0x17,
        WM_SHOWWINDOW = 0x18,
        WM_CTLCOLOR = 0x19,
        WM_WININICHANGE = 0x1A,
        WM_SETTINGCHANGE = 0x1A,
        WM_DEVMODECHANGE = 0x1B,
        WM_ACTIVATEAPP = 0x1C,
        WM_FONTCHANGE = 0x1D,
        WM_TIMECHANGE = 0x1E,
        WM_CANCELMODE = 0x1F,
        WM_SETCURSOR = 0x20,
        WM_MOUSEACTIVATE = 0x21,
        WM_CHILDACTIVATE = 0x22,
        WM_QUEUESYNC = 0x23,
        WM_GETMINMAXINFO = 0x24,
        WM_PAINTICON = 0x26,
        WM_ICONERASEBKGND = 0x27,
        WM_NEXTDLGCTL = 0x28,
        WM_SPOOLERSTATUS = 0x2A,
        WM_DRAWITEM = 0x2B,
        WM_MEASUREITEM = 0x2C,
        WM_DELETEITEM = 0x2D,
        WM_VKEYTOITEM = 0x2E,
        WM_CHARTOITEM = 0x2F,
        WM_SETFONT = 0x30,
        WM_GETFONT = 0x31,
        WM_SETHOTKEY = 0x32,
        WM_GETHOTKEY = 0x33,
        WM_QUERYDRAGICON = 0x37,
        WM_COMPAREITEM = 0x39,
        WM_COMPACTING = 0x41,
        WM_WINDOWPOSCHANGING = 0x46,
        WM_WINDOWPOSCHANGED = 0x47,
        WM_POWER = 0x48,
        WM_COPYDATA = 0x4A,
        WM_CANCELJOURNAL = 0x4B,
        WM_NOTIFY = 0x4E,
        WM_INPUTLANGCHANGEREQUEST = 0x50,
        WM_INPUTLANGCHANGE = 0x51,
        WM_TCARD = 0x52,
        WM_HELP = 0x53,
        WM_USERCHANGED = 0x54,
        WM_NOTIFYFORMAT = 0x55,
        WM_CONTEXTMENU = 0x7B,
        WM_STYLECHANGING = 0x7C,
        WM_STYLECHANGED = 0x7D,
        WM_DISPLAYCHANGE = 0x7E,
        WM_GETICON = 0x7F,
        WM_SETICON = 0x80,
        WM_NCCREATE = 0x81,
        WM_NCDESTROY = 0x82,
        WM_NCCALCSIZE = 0x83,
        WM_NCHITTEST = 0x84,
        WM_NCPAINT = 0x85,
        WM_NCACTIVATE = 0x86,
        WM_GETDLGCODE = 0x87,
        WM_NCMOUSEMOVE = 0xA0,
        WM_NCLBUTTONDOWN = 0xA1,
        WM_NCLBUTTONUP = 0xA2,
        WM_NCLBUTTONDBLCLK = 0xA3,
        WM_NCRBUTTONDOWN = 0xA4,
        WM_NCRBUTTONUP = 0xA5,
        WM_NCRBUTTONDBLCLK = 0xA6,
        WM_NCMBUTTONDOWN = 0xA7,
        WM_NCMBUTTONUP = 0xA8,
        WM_NCMBUTTONDBLCLK = 0xA9,
        WM_KEYFIRST = 0x100,
        WM_KEYDOWN = 0x100,
        WM_KEYUP = 0x101,
        WM_CHAR = 0x102,
        WM_DEADCHAR = 0x103,
        WM_SYSKEYDOWN = 0x104,
        WM_SYSKEYUP = 0x105,
        WM_SYSCHAR = 0x106,
        WM_SYSDEADCHAR = 0x107,
        WM_KEYLAST = 0x108,
        WM_IME_STARTCOMPOSITION = 0x10D,
        WM_IME_ENDCOMPOSITION = 0x10E,
        WM_IME_COMPOSITION = 0x10F,
        WM_IME_KEYLAST = 0x10F,
        WM_INITDIALOG = 0x110,
        WM_COMMAND = 0x111,
        WM_SYSCOMMAND = 0x112,
        WM_TIMER = 0x113,
        WM_HSCROLL = 0x114,
        WM_VSCROLL = 0x115,
        WM_INITMENU = 0x116,
        WM_INITMENUPOPUP = 0x117,
        WM_MENUSELECT = 0x11F,
        WM_MENUCHAR = 0x120,
        WM_ENTERIDLE = 0x121,
        WM_CTLCOLORMSGBOX = 0x132,
        WM_CTLCOLOREDIT = 0x133,
        WM_CTLCOLORLISTBOX = 0x134,
        WM_CTLCOLORBTN = 0x135,
        WM_CTLCOLORDLG = 0x136,
        WM_CTLCOLORSCROLLBAR = 0x137,
        WM_CTLCOLORSTATIC = 0x138,
        WM_MOUSEFIRST = 0x200,
        WM_MOUSEMOVE = 0x200,
        WM_LBUTTONDOWN = 0x201,
        WM_LBUTTONUP = 0x202,
        WM_LBUTTONDBLCLK = 0x203,
        WM_RBUTTONDOWN = 0x204,
        WM_RBUTTONUP = 0x205,
        WM_RBUTTONDBLCLK = 0x206,
        WM_MBUTTONDOWN = 0x207,
        WM_MBUTTONUP = 0x208,
        WM_MBUTTONDBLCLK = 0x209,
        WM_MOUSEWHEEL = 0x20A,
        WM_MOUSEHWHEEL = 0x20E,
        WM_PARENTNOTIFY = 0x210,
        WM_ENTERMENULOOP = 0x211,
        WM_EXITMENULOOP = 0x212,
        WM_NEXTMENU = 0x213,
        WM_SIZING = 0x214,
        WM_CAPTURECHANGED = 0x215,
        WM_MOVING = 0x216,
        WM_POWERBROADCAST = 0x218,
        WM_DEVICECHANGE = 0x219,
        WM_MDICREATE = 0x220,
        WM_MDIDESTROY = 0x221,
        WM_MDIACTIVATE = 0x222,
        WM_MDIRESTORE = 0x223,
        WM_MDINEXT = 0x224,
        WM_MDIMAXIMIZE = 0x225,
        WM_MDITILE = 0x226,
        WM_MDICASCADE = 0x227,
        WM_MDIICONARRANGE = 0x228,
        WM_MDIGETACTIVE = 0x229,
        WM_MDISETMENU = 0x230,
        WM_ENTERSIZEMOVE = 0x231,
        WM_EXITSIZEMOVE = 0x232,
        WM_DROPFILES = 0x233,
        WM_MDIREFRESHMENU = 0x234,
        WM_IME_SETCONTEXT = 0x281,
        WM_IME_NOTIFY = 0x282,
        WM_IME_CONTROL = 0x283,
        WM_IME_COMPOSITIONFULL = 0x284,
        WM_IME_SELECT = 0x285,
        WM_IME_CHAR = 0x286,
        WM_IME_KEYDOWN = 0x290,
        WM_IME_KEYUP = 0x291,
        WM_MOUSEHOVER = 0x2A1,
        WM_NCMOUSELEAVE = 0x2A2,
        WM_MOUSELEAVE = 0x2A3,
        WM_CUT = 0x300,
        WM_COPY = 0x301,
        WM_PASTE = 0x302,
        WM_CLEAR = 0x303,
        WM_UNDO = 0x304,
        WM_RENDERFORMAT = 0x305,
        WM_RENDERALLFORMATS = 0x306,
        WM_DESTROYCLIPBOARD = 0x307,
        WM_DRAWCLIPBOARD = 0x308,
        WM_PAINTCLIPBOARD = 0x309,
        WM_VSCROLLCLIPBOARD = 0x30A,
        WM_SIZECLIPBOARD = 0x30B,
        WM_ASKCBFORMATNAME = 0x30C,
        WM_CHANGECBCHAIN = 0x30D,
        WM_HSCROLLCLIPBOARD = 0x30E,
        WM_QUERYNEWPALETTE = 0x30F,
        WM_PALETTEISCHANGING = 0x310,
        WM_PALETTECHANGED = 0x311,
        WM_HOTKEY = 0x312,
        WM_PRINT = 0x317,
        WM_PRINTCLIENT = 0x318,
        WM_HANDHELDFIRST = 0x358,
        WM_HANDHELDLAST = 0x35F,
        WM_PENWINFIRST = 0x380,
        WM_PENWINLAST = 0x38F,
        WM_COALESCE_FIRST = 0x390,
        WM_COALESCE_LAST = 0x39F,
        WM_DDE_FIRST = 0x3E0,
        WM_DDE_INITIATE = 0x3E0,
        WM_DDE_TERMINATE = 0x3E1,
        WM_DDE_ADVISE = 0x3E2,
        WM_DDE_UNADVISE = 0x3E3,
        WM_DDE_ACK = 0x3E4,
        WM_DDE_DATA = 0x3E5,
        WM_DDE_REQUEST = 0x3E6,
        WM_DDE_POKE = 0x3E7,
        WM_DDE_EXECUTE = 0x3E8,
        WM_DDE_LAST = 0x3E8,
        WM_USER = 0x400,
        WM_APP = 0x8000
    };

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct WNDCLASS
    {
        public uint style;
        public WNDPROC lpfnWndProc;
        public int cbClsExtra;
        public int cbWndExtra;
        public IntPtr hInstance;
        public IntPtr hIcon;
        public IntPtr hCursor;
        public IntPtr hbrBackground;
        [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
        public string lpszMenuName;
        [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
        public string lpszClassName;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct WNDCLASSEX
    {
        [MarshalAs(UnmanagedType.U4)]
        public uint cbSize;
        [MarshalAs(UnmanagedType.U4)]
        public int style;
        public WNDPROC lpfnWndProc;
        public int cbClsExtra;
        public int cbWndExtra;
        public IntPtr hInstance;
        public IntPtr hIcon;
        public IntPtr hCursor;
        public IntPtr hbrBackground;
        [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
        public string lpszMenuName;
        [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
        public string lpszClassName;
        public IntPtr hIconSm;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct MSG
    {
        public IntPtr hwnd;
        public uint message;
        public IntPtr wParam;
        public IntPtr lParam;
        public uint time;
        public POINT pt;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct NCCALCSIZE_PARAMS
    {
        public RECT rgrc0, rgrc1, rgrc2;
        public WINDOWPOS lppos;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        public int left, top, right, bottom;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct WINDOWPOS
    {
        public IntPtr hwnd;
        public IntPtr hwndinsertafter;
        public int x, y, cx, cy;
        public int flags;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct MINMAXINFO
    {
        public POINT ptReserved;
        public POINT ptMaxSize;
        public POINT ptMaxPosition;
        public POINT ptMinTrackSize;
        public POINT ptMaxTrackSize;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct MARGINS
    {
        public int cxLeftWidth, cxRightWidth, cyTopHeight, cyBottomHeight;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct BLENDFUNCTION
    {
        public byte BlendOp;
        public byte BlendFlags;
        public byte SourceConstantAlpha;
        public byte AlphaFormat;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct POINT
    {
        public int x, y;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct POINTS
    {
        public short x, y;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct SIZE
    {
        public int cx, cy;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct DWM_BLURBEHIND
    {
        uint dwFlags;
        bool fEnable;
        IntPtr hRgnBlur;
        bool fTransitionOnMaximized;
    }

    public delegate IntPtr WNDPROC(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
}
